package service;

import domain.User;
import persistence.UserDao;
import persistence.UserDaoImpl;

public class UserService {
    private UserDao userDao;
    private String msg;

    public UserService(){
        this.userDao = new UserDaoImpl();
    }

    public User login(String username,String password){
        User loginUser = this.userDao.findUserByUsernameAndPassword(username,password);
        if(loginUser == null){
            this.msg = "用户名或密码错误";
            return null;
        }
        return loginUser;
    }
}
